/**
 * 
 */
package net.sahv.bdyz.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sahv.bdyz.mapper.ShoppingCartMapper;
import net.sahv.bdyz.model.ShoppingCart;
import net.sahv.bdyz.util.PageInfo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 张天敏
 * @date 日期：2016年8月3日 时间：下午4:30:32
 */
@Service
public class ShoppingCartService {

	@Autowired
	private ShoppingCartMapper shoppingCartMapper;

	public int deleteByPrimaryKey(Integer scId) {
		return shoppingCartMapper.deleteByPrimaryKey(scId);
	}

	public int insert(ShoppingCart record) {
		return shoppingCartMapper.insert(record);
	}

	public ShoppingCart selectByPrimaryKey(Integer scId) {
		return shoppingCartMapper.selectByPrimaryKey(scId);
	}
	public ShoppingCart selectstatusling(String oNo, Integer mId, Integer ppId) {
		return shoppingCartMapper.selectstatusling(oNo,mId,ppId);
	}
	public ShoppingCart selectstatusyi(String oNo, Integer mId) {
		return shoppingCartMapper.selectstatusyi(oNo,mId);
	}
	public ShoppingCart selectstatuser(String oNo,String ofNo, Integer mId, Integer ppId) {
		return shoppingCartMapper.selectstatuser(oNo,ofNo,mId,ppId);
	}
	public ShoppingCart selectstatussan(String oNo, Integer mId,String colorImg) {
		return shoppingCartMapper.selectstatussan(oNo,mId,colorImg);
	}

	public List<ShoppingCart> selectAll() {
		return shoppingCartMapper.selectAll();
	}

	public int updateByPrimaryKey(ShoppingCart record) {
		return shoppingCartMapper.updateByPrimaryKey(record);
	}

	public List<Map<String, Object>> findAll(PageInfo pageInfo, String where, String order) {
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("myCount", pageInfo.getCount());
		param.put("pageSize", pageInfo.getPageSize());
		param.put("page", pageInfo.getPage());
		param.put("where", where);
		param.put("order", order);
		List<Map<String, Object>> m = shoppingCartMapper.findAll(param);
		pageInfo.setCount(Integer.parseInt(param.get("myCount").toString()));
		return m;
	}

	public List<Map<String, Object>> selectAllByMid(Integer mId,String yuyan) {
		return shoppingCartMapper.selectAllByMid(mId,yuyan);
	}

}
